<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
    <style>
        .yonghu{position:relative;width:500px;height:300px;margin:0 auto;
            border: 2px solid #DADADA;text-align: center; }
table tr td{ float:right;margin-left: 150px;}

    </style>
    <script>
        //检查两次输入密码是否一致
        function checkForm(){
            var pw1 = document.getElementById("pw1").value;
            var pw2 = document.getElementById("pw2").value;
            if(pw1 !== pw2){
                alert('两次输入密码不一致！');
                return false;
            }
            return true;
        }
    </script>
</head>
<body>
<div class="yonghu">
<h1>用户注册</h1>
 <form method="post" action="register.php" onsubmit="return checkForm()">
     <table>
    <tr><td>   用户名：<input type="text" name="username"/></td></tr>
         <tr><td> 密    码：<input type="password" name="password" id="pw1" /></td></tr>
         <tr><td> 密码确认：<input type="password" id="pw2" /></td></tr>
     <tr><td> 邮    箱：<input type="text" name="email"/></td></tr>


     <tr><td colspan="2">
     <input type="submit" value="提交注册"/>
     <input type="reset" value="重新填写"/>
     </td></tr>
     </table>
 </form>
</div>
</body>
</html>